package com.googlecode.perfectable.messageable;

import javax.xml.namespace.QName;

public class UnknownMessageException extends Exception {
	private static final long serialVersionUID = -1416638350505211370L;
	
	private static final String MESSAGE_CLASS_FORMAT = "Message of unknown type found: %s";
	private static final String MESSAGE_NAME_FORMAT = "Message of unknown name found: %s";

	public static UnknownMessageException ofName(QName name) {
		String message = String.format(MESSAGE_NAME_FORMAT, name);
		return new UnknownMessageException(message);
	}
	
	public static UnknownMessageException ofClass(Class<? extends Message> messageClass) {
		String message = String.format(MESSAGE_CLASS_FORMAT, messageClass);
		return new UnknownMessageException(message);
	}
	
	private UnknownMessageException(String message) {
		super(message);
	}
	
}
